/**
 * Created by Ysssssss on 21/1/14.
 */
import { all } from 'redux-saga/effects'
import commonSagas from './common'
import userSagas from './user'
import productCenterSagas from './productCenter'
import employeeSagas from './employee'
import customerSagas from './customer'
import paymentSagas from './payment'
import storeSagas from './storeManagement'
import shoppingMallSagas from './shoppingMall'
import thirdpartySagas from './thirdparty'
import marketingSagas from './marketing'
import _ from 'lodash'
import warehouseSagas from './warehouse'
const run = sagas => sagas.map(saga => saga())

export default function* rootSaga() {
    yield all([
        ...run([
            ...commonSagas,
            ...userSagas,
            ...storeSagas,
            ...employeeSagas,
            ...customerSagas,
            ...paymentSagas,
            ...productCenterSagas,
            ...thirdpartySagas,
            ...marketingSagas,
            ..._.flatten(Object.values(warehouseSagas)),
            ..._.flatten(Object.values(shoppingMallSagas))
        ]),
    ])
}